package com.example.administrator.testpersionn.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.util.List;

public class Binner extends ViewPager {
    List<String> images;
    Context context;

    public Binner(@NonNull Context context) {
        super(context,null);
    }

    public Binner(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }


    class ViewAdapter extends PagerAdapter{

        @Override
        public int getCount() {
            return images.size();
        }

        @Override
        public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
            return view==o;
        }

        @Override
        public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
            container.removeView((ImageView)object);
        }

        @NonNull
        @Override
        public Object instantiateItem(@NonNull ViewGroup container, int position) {
            ImageView imageView=new ImageView(context);
            container.addView(imageView);
            return super.instantiateItem(container, position);
        }
    }




}
